#include "stdafx.h"
#include "TextureClass.h"


CTextureClass::CTextureClass(void) : m_pTexture(nullptr)
{
}


CTextureClass::~CTextureClass(void)
{
}

bool CTextureClass::Initialize(ID3D11Device* pDevice, WCHAR* pwscTextureFileName)
{
	HRESULT hResult;

	hResult = D3DX11CreateShaderResourceViewFromFile(pDevice, pwscTextureFileName, NULL, NULL, &m_pTexture, NULL);
	if(FAILED(hResult))
	{
		DEBUG_OUTPUT("Failed to create texture");
		return false;
	}

	return true;
}

void CTextureClass::ShutDown()
{
	if(m_pTexture != nullptr)
	{
		m_pTexture->Release();
		m_pTexture = nullptr;
	}
}

ID3D11ShaderResourceView* CTextureClass::GetTexture()
{
	return m_pTexture;
}